#include <bits/stdc++.h>
#define gc() (ibo_ == ied_ ? (ied_ = buf + fread(ibo_ = buf, 1, 1 << 20, stdin), ibo_ == ied_ ? EOF : *ibo_++) : *ibo_++)
#define pr(x) (_p_ - puf == 1 << 20 ? (fwrite(puf, 1, 1 << 20, stdout), _p_ = puf) : 0, *_p_++ = x)
#define read() ({ register int x = 0, f = 1; register char c = gc(); while(c < '0' || c > '9') { if (c == '-') f = -1; c = gc();} while(c >= '0' && c <= '9') x = x * 10 + (c & 15), c = gc(); f * x; })
char buf[1 << 20], puf[1 << 20], *_p_ = puf, *ibo_, *ied_;
int print(long long x) { return x <= 9 ? pr(x + '0') : (print(x / 10), pr(x % 10 + '0')); }
#define T() int T; cin >> T; while(T --)
#define F_(n) cout << fixed << setprecision(n)

using namespace std;
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
/*static int _ = [](){
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    return 0;
}();//*/
typedef pair<int, int> PII;
unordered_map<int, bool> M;
typedef long long LL;
const int N = 1e5 + 5, MOD = 1e9 + 7;
bool _Flag;
int n, m, arr[N];

signed main() {
	#ifndef ONLINE_JUDGE
		_Flag = false; //freopen("C:\\Users\\lenovo\\Desktop\\in.in", "r", stdin);
	#endif
	string s;
	cin >> s;
	int nex = 0;
	for (int i = 1; i < s.size(); ++ i) {
		if (s[i] == s[nex]) arr[i] = ++ nex;
		else arr[i] = (s[i] == s[nex = 0] ? nex ++ : -1);
	} 
	for (int i = 0; i < s.size(); ++ i) {
		cout << arr[i] << ' ';
	}
	return 0;
}



